const http = require('../../utils/http.js');   //相对路径
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },
  attached: function () {
    http.postRequest('/mini/v1/home/technician', {}, res=>{
      this.setData({
        waitExecute: res.data.wait_execute,//待施工数量 <number>
        waitFinish: res.data.wait_finish,//待完工数量 <number>
        waitClearing: res.data.wait_clearing,
        noticeData:res.data.notice_data
      })
      wx.setNavigationBarTitle({
        title:res.data.shop_name    // 其他页面传过来的标题名
      })
    })
  },
  /**
   * 组件的初始数据
   */
  data: {
    current: 0,
    waitExecute: '',//待施工数量 <number>
    waitFinish: '',//待完工数量 <number>
    waitClearing: '',
    noticeData:''
  },

  /**
   * 组件的方法列表
   */
  methods: {
    // 工单管理
    skip() {
      wx.navigateTo({
        url: '/pages/index/work/work?name=' + '1',
      })
    },
    //维保开单
    weibao() {
      wx.showModal({
        title: '提示',
        showCancel: false,
        content: '功能正在开发中,敬请期待!!'
      })
    },
    // 销售开单
    kaidan() {
      wx.navigateTo({
        url: '/pages/openOrder/repair/repair',
      })
    },
    statepage(e) {
      const name = e.currentTarget.dataset.name
      wx.navigateTo({
        url: '/pages/index/work/work?name='+ name
      })
    },

    gopage(e) {
      let name=e.currentTarget.dataset.name
      if(name == 'select'){
        wx.navigateTo({
          url: '/pages/classify/kehu',
        })
      }else if(name == 'openCard'){
        wx.navigateTo({
          url: '/pages/openCard/openCard/openCard',
        })
      }else if(name == 'cardList'){
        wx.navigateTo({
          url: '/pages/openCard/bySingle/bySingle',
        })
      }
    }
  }
})